/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace DaveSexton.DocProject
{
	public class HelpItem : MarshalByRefObject
	{
		#region Public Properties
		public string Name
		{
			get
			{
				return name;
			}
		}

		public string File
		{
			get
			{
				return file;
			}
		}

		public IEnumerable<HelpItem> Subitems
		{
			get
			{
				return (subitems == null) ? null : new MarshalByRefEnumerable<HelpItem>(subitems);
			}
		}
		#endregion

		#region Private / Protected
		private readonly string name, file;
		private readonly IEnumerable<HelpItem> subitems;
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="HelpItem" /> class.
		/// </summary>
		public HelpItem(string name, string file)
		{
			// allow null or empty values
			this.name = name;
			this.file = file;
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="HelpItem" /> class.
		/// </summary>
		public HelpItem(string name, string file, IEnumerable<HelpItem> subitems)
			: this(name, file)
		{
			this.subitems = subitems;
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="HelpItem" /> class.
		/// </summary>
		public HelpItem(string name, string file, params HelpItem[] subitems)
			: this(name, file, (IEnumerable<HelpItem>) subitems)
		{
		}
		#endregion

		#region Methods
		[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand,
			Flags = System.Security.Permissions.SecurityPermissionFlag.Infrastructure)]
		public override object InitializeLifetimeService()
		{
			return null;
		}
		#endregion
	}
}
